package com.mallcai.bigdata.ladon.dpl.mapper.report.provider;

import com.mallcai.bigdata.ladon.dpl.entity.report.ReportColumn;
import com.mallcai.bigdata.ladon.dpl.mapper.BaseSqlProvider;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author gst
 * @date 2019-12-30 20:36
 */
public class ReportColumnSqlProvider extends BaseSqlProvider<ReportColumn> {

    public static final String TB_REPORT_COLUMN = "r_report_column";

    /**
     * 获取表名
     *
     * @return String
     */
    @Override
    public String getTableName() {
        return TB_REPORT_COLUMN;
    }

    /**
     * 获取插入数据的字段列表
     *
     * @return Map
     */
    @Override
    public Map<String, String> getInsertColumns() {
        Map<String, String> map = new LinkedHashMap<>();
        map.put("report_id", "#{reportId}");
        map.put("raw", "#{raw}");
        map.put("name", "#{name}");
        map.put("show_name", "#{showName}");
        map.put("data_type", "#{dataType}");
        map.put("unit", "#{unit}");
        map.put("hidden", "#{hidden}");
        map.put("drill", "#{drill}");
        map.put("support_sort", "#{supportSort}");
        map.put("drill_report_id", "#{drillReportId}");
        map.put("drill_params", "#{drillParams}");
        map.put("frozen", "#{frozen}");
        map.put("split", "#{split}");
        map.put("split_char", "#{splitChar}");
        map.put("split_kv_char", "#{splitKvChar}");
        map.put("format_macro", "#{formatMacro}");
        map.put("sort_id", "#{sortId}");
        map.put("comment", "#{comment}");
        return map;
    }

    /**
     * 获取更新操作的字段列表
     *
     * @return Map
     */
    @Override
    public Map<String, String> getUpdateColumns() {
        Map<String, String> map = new LinkedHashMap<>();
        map.put("reportId", "report_id");
        map.put("raw", "raw");
        map.put("name", "name");
        map.put("showName", "show_name");
        map.put("dataType", "data_type");
        map.put("unit", "unit");
        map.put("hidden", "hidden");
        map.put("drill", "drill");
        map.put("supportSort", "support_sort");
        map.put("drillReportId", "drill_report_id");
        map.put("drillParams", "drill_params");
        map.put("frozen", "frozen");
        map.put("split", "split");
        map.put("splitChar", "split_char");
        map.put("splitKvChar", "split_kv_char");
        map.put("formatMacro", "format_macro");
        map.put("sortId", "sort_id");
        map.put("comment", "comment");
        return map;
    }
}
